﻿using DotNetExtensions.Core.Restful;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using CoreWebSimple.JWT;
using DotNetExtensions.Core.MVC;
using DotNetExtensions.Core.WebApi;

namespace CoreWebSimple.Controllers
{
    [Authorize]
    [ApiController]
    [Route("api/[controller]/[action]")]
    public class AuthController : ControllerBase
    {
        private readonly Session<UserModel> _session;
        public AuthController(Session<UserModel> session)
        {
            _session = session;
        }

        [HttpGet]
        public ApiResult<string> GetToken()
        {
            return ApiResult.OK(DateTime.Now.ToString() + "," + _session.User?.Name);
        }
    }
}
